package com.example.floristshop.utils;

import android.graphics.Color;
import android.util.Log;

import com.example.floristshop.R;
import com.example.floristshop.database.Comment;
import com.example.floristshop.database.Flower;
import com.example.floristshop.database.Record;
import com.example.floristshop.database.User;

import org.litepal.LitePal;

public class InitDatabaseUtil {
    public static void initDatabase(){
        initUser();
        initFlower();
        initComment();
        initRecord();
    }

    public static void initUser(){
        Log.d("lyc", "initUser");
        User u1 = new User(10001, "Alex", 4, "7720");
        u1.save();
        User u2 = new User(10002, "LiuMm", 3, "cici");
        u2.save();
        User u3 = new User(10003, "EeVy", 1, "pwd");
        u3.save();
        User u4 = new User(10004, "hoga", 2, "hhhh");
        u4.save();
        User u5 = new User(10005, "许经理", 3, "hhhh");
        u5.save();
        User u6 = new User(10006, "小李", 4, "hhhh");
        u6.save();
    }

    public static void initFlower(){
        Log.d("lyc", "initFlower");

        Flower f1 = new Flower(1,
                "卡罗拉红玫瑰11枝",
                "花语：人间蹉跎，你是唯一值得\n" +
                        "材料：卡罗拉红玫瑰11枝、白色满天星3枝、尤加利10枝\n" +
                        "包装：红/金色鎏金纸5张、白色雪梨纸2张、酒红色罗纹烫金丝带2米",
                "爱情",
                "昆明",
                R.mipmap.flower1_image);
        f1.save();

        Flower f2 = new Flower(2,
                "韩式系列/温柔以待",
                "花语：温柔的人，都是人间宝藏。\n材料：粉色康乃馨13枝，戴安娜粉玫瑰5枝、3头以上粉色洋桔梗5枝、浅紫紫罗兰5枝（紫罗兰花期为12-4月，其他月份用浅紫色金鱼草/浅紫色桔梗/浅紫色风铃花等相似线状花材替代）、尤加利10枝",
                "感恩",
                "昆明",
                R.mipmap.flower2_image);
        f2.save();

        Flower f3 = new Flower(3,
                "母爱",
                "花语：这一生的浪漫与宠溺，记得给母亲留一份\n材料：玫红色康乃馨9枝、粉色多头康乃馨10枝\n包装：樱粉色雪梨纸3张、香芋紫人造纸2张、粉色opp雾面纸3张、白蓝罗纹带1米",
                "感恩",
                "昆明",
                R.mipmap.flower3_image);
        f3.save();

        Flower f4 = new Flower(4,
                "不变的承诺",
                "花语：下雨的时候，给她撑一把雨伞；寒冷的时候，给她一个温暖的臂弯；天黑了，永远有一盏灯为她点亮；晨起时，给她一缕温暖的阳光。爱她，就送她一束99枝的玫瑰花！\n" + "材料：99枝卡罗拉红玫瑰\n" + "包装：黑色雪梨纸，黑色条纹纸，玻璃纸卷，酒红色缎带花结",
                "爱情",
                "昆明",
                R.mipmap.flower4_image);
        f4.save();

        Flower f5 = new Flower(5,
                "用心爱你",
                "花语：不管时空怎么转变，世界怎么改变，你的爱总在我心间。\n" +
                        "材料：33枝戴安娜粉玫瑰、66枝卡罗拉红玫瑰、10枝满天星\n" +
                        "包装：粉色opp雾面纸6张、酒红色缎带2米",
                "爱情",
                "昆明",
                R.mipmap.flower5_image);
        f5.save();

        Flower f6 = new Flower(6,
                "花好月圆永生花台灯/送老师长辈定制款",
                "花材：进口多色永生康乃馨、永生花玫瑰、双色永生绣球、尤加利果、松果、八角花、虞美人、情人草、小叶黄杨、羊齿叶、红色米花\n" + "主体尺寸：高：23cm，宽20cm，长10cm\n" + "通电方式：USB插电（非充电版）",
                "永生花",
                "尼泊尔",
                R.mipmap.flower6_image);
        f6.save();

        Flower f7 = new Flower(7,
                "Be My Love",
                "材料：尼泊尔进口红色永生玫瑰（直径6-7cm）2枝，进口白色永生玫瑰（直径5-6cm)1枝，棉花2朵，进口粉色珍珠5颗，红色小果子2枝，桂皮、秋色绿绣球、松枝、小叶尤加利叶永生花适量\n" + "包装：玻璃罩 蓝色定制礼盒",
                "永生花",
                "尼泊尔",
                R.mipmap.flower7_image);
        f7.save();
    }

    public static void initComment(){
        Log.d("lyc", "initComment");
        Comment c1 = new Comment(1653175484, "花很新鲜，速度也很快，朋友很喜欢", 1, 10001);
        Comment c2 = new Comment(1644842528, "实物与图片相符，店家用心，女友开心，男生省心。给店家好评！您们辛苦了", 1, 10002);
        Comment c3 = new Comment(1641965460, "花很新鲜，颜色也很正，都是绽放的花，看着很有感觉。我们家宝很喜欢。", 1, 10004);
        c1.save();
        c2.save();
        c3.save();

        Comment c4 = new Comment(1652242463, "妈妈很开心，花花也超级好看！！很温柔", 2, 10002);
        Comment c5 = new Comment(1650783123, "颜色很不错花也还新鲜 妈妈很喜欢", 2, 10003);
        c4.save();
        c5.save();

        Comment c6 = new Comment(1652199577, "鲜花质量不错，母亲很喜欢，就是感觉比起示意图，感觉大花朵的颜色略浅。", 3, 10004);
        Comment c7 = new Comment(1652171507, "花束非常漂亮，妈妈非常喜欢！谢谢店家的服务，非常满意！", 3, 10001);
        c6.save();
        c7.save();

        Comment c8 = new Comment(1633821577, "老婆收到很高兴，爱情需要牵挂和表达", 4, 10002);
        c8.save();

        Comment c9 = new Comment(1652084927, "送给男朋友妈妈的母亲节礼物！男朋友妈妈很喜欢！！真的很好看哟！可以当摆台又可以当灯照明！！很实用又很好看，长辈们也很喜欢！考虑给自己妈妈也买一个啦！而且贺卡写得很贴心", 6, 10003);
        c9.save();

        Comment c10 = new Comment(1640512487, "又可爱又精致！", 7, 10004);
        c10.save();
    }

    public static void initRecord(){
        Log.d("lyc", "initRecord");
        Record r1 = new Record(1653175484, 1, 158.00, 1, 10005);
        Record r2 = new Record(1644842528, 2, 316.00, 1, 10005);
        Record r3 = new Record(1641965460, 1, 158.00, 1, 10005);
        r1.save();
        r2.save();
        r3.save();

        Record r4 = new Record(1652242463, 2, 458.00, 2, 10006);
        Record r5 = new Record(1650783123, 1, 239.00, 2, 10006);
        r4.save();
        r5.save();

        Record r6 = new Record(1652199577, 1, 179.00, 3, 10005);
        Record r7 = new Record(1652171507, 1, 179.00, 3, 10005);
        r6.save();
        r7.save();

        Record r8 = new Record(1633821577, 1, 520.00, 4, 10006);
        r8.save();

        Record r9 = new Record(1652084927, 1, 298.00, 6, 10005);
        r9.save();

        Record r10 = new Record(1640512487, 1, 398.00, 7, 10006);
        r10.save();
    }
}
